#include<stdio.h>
#include<stdlib.h>
    int returnIndex(int* a, int sz1, int* b, int sz2){
        int i, j, ret = 0;
        for(i = 0; i < sz1; i++){
            for(j = 0; j <sz2; j++){
                if(a[i] == b[j]){
                    ret++;
                    break;
                }
            }
        }
        return ret;
    }
    int* findIntersectionValues(int* nums1, int nums1Size, int* nums2, int nums2Size, int* returnSize) {
        int* a = (int*)malloc(sizeof(int) * 2);
        a[0] = returnIndex(nums1, nums1Size, nums2, nums2Size);
        a[1] = returnIndex(nums2, nums2Size, nums1, nums1Size);
        
        // printf("%d %d",a[0], a[1]);
        *returnSize = 2;

        return a;
    }
int main1(){
    int nums1[] = {4,3,2,3,1}, nums2[] = {2,2,5,2,3,6};
    int* returnSize;
    int* a = findIntersectionValues(nums1, 5, nums2, 6, returnSize);
    for(int i = 0; i < *returnSize; i++){
        printf("%d ", a[i]);
    }
    free(a);
    return 0;
}